<template>
	<view>
		<navbar :title="title"></navbar>
		<rich-text :nodes="content"></rich-text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: '',
				title: '',
				content: ''
			};
		},
		onLoad(options) {
			if(options.type) {
				this.type = options.type
				if(this.type == 1) {
					this.title = '用户协议'
					this.getSetting('userAgreement', 'userAgreement')
				}else if(this.type == 2) {
					this.title = '隐私政策'
					this.getSetting('privacyAgreement', 'privacyAgreement')
				}
			}
		},
		methods: {
			getSetting(groupKey, valueKey) {
				this.api.appSettingFunc({
					groupKey: groupKey,
					valueKey: valueKey
				}).then(res => {
					if(res.code == 200) {
						this.content = res.data
					}
				})
			},
		}
	}
</script>

<style lang="scss">

</style>
